<script setup>
import FirstTitle from "@comp/FirstTitle";
import { onMounted } from "vue";
import PsbzTable from "@comp/llyy/PsbzTable";
import { postJbfaTable } from "@/api/table";

const city = window.globalObj.name;

const jshjgHeaders = [
  {
    label: "序号",
    prop: "data0",
    minWidth: "60",
  },
  {
    label: "行政区域",
    prop: "data1",
    minWidth: "90",
  },
  {
    label: "指挥所名称",
    prop: "data2",
    minWidth: "300",
  },
  {
    label: "类型",
    prop: "data3",
    minWidth: "90",
  },
  {
    label: "地址",
    prop: "data4",
    minWidth: "90",
  },
  {
    label: "经纬度",
    prop: "data5",
    minWidth: "90",
  },
];

const jshjgList = ref([
  {
    data0: "X",
    data1: "X",
    data2: "X",
    data3: "X",
    data4: "X",
    data5: "X",
  },
]);

const zydHeaders = [
  {
    label: "序号",
    prop: "data0",
    minWidth: "90",
  },
  {
    label: "行政区划（域）",
    prop: "data1",
    minWidth: "90",
  },
  {
    label: "专业队名称",
    prop: "data2",
    minWidth: "300",
  },
  {
    label: "类型",
    prop: "data3",
    minWidth: "90",
  },
  {
    label: "分队类型",
    prop: "data4",
    minWidth: "90",
  },
  {
    label: "牵头单位",
    prop: "data5",
    minWidth: "90",
  },
  {
    label: "组建单位",
    prop: "data6",
    minWidth: "90",
  },
  {
    label: "人数",
    prop: "data7",
    minWidth: "90",
  },
];

const zydList = ref([
  {
    data0: "X",
    data1: "X",
    data2: "X",
    data3: "X",
    data4: "X",
    data5: "X",
    data6: "X",
    data7: "X",
  },
]);

const zymbHeaders = [
  {
    label: "序号",
    prop: "data0",
    minWidth: "90",
  },
  {
    label: "行政区划（域）",
    prop: "data1",
    minWidth: "90",
  },
  {
    label: "目标名称",
    prop: "data2",
    minWidth: "300",
  },
  {
    label: "地址",
    prop: "data3",
    minWidth: "90",
  },
  {
    label: "目标等级",
    prop: "data4",
    minWidth: "90",
  },
  {
    label: "目标性质",
    prop: "data5",
    minWidth: "90",
  },
  {
    label: "关键防护部位",
    prop: "data6",
    minWidth: "90",
  },
  {
    label: "联系人",
    prop: "data7",
    minWidth: "90",
  },
  {
    label: "联系电话",
    prop: "data8",
    minWidth: "90",
  },
];

const zymbList = ref([
  {
    data0: "X",
    data1: "X",
    data2: "X",
    data3: "X",
    data4: "X",
    data5: "X",
    data6: "X",
    data7: "X",
    data8: "X",
  },
]);

// 指挥机构编成表
const getZhjgData = () => {
  return postJbfaTable("zhjgbcbList").then((res) => {
    if (res.code === 200) {
      jshjgList.value = res?.data || [];
    }
  });
};
// 专业队力量编成表
const getZydData = () => {
  return postJbfaTable("zydllbcbList").then((res) => {
    if (res.code === 200) {
      zydList.value = res?.data || [];
    }
  });
};
// 重要目标统计表
const getZymbData = () => {
  return postJbfaTable("zymbtjbList").then((res) => {
    if (res.code === 200) {
      zymbList.value = res?.data || [];
    }
  });
};

onMounted(async () => {
  await getZhjgData();
  await getZydData();
  await getZymbData();
});
</script>
<template>
  <div>
    <FirstTitle name="针对性战备建设" class="top-15" />
    <div class="img-box top-15 flex-justify-center-center">
      <img src="@/assets/img/jbfa/xdzhlc.png" />
    </div>
    <FirstTitle :name="city + '指挥机构编成表'" class="top-15" />
    <PsbzTable :headers="jshjgHeaders" :tableData="jshjgList" />
    <FirstTitle :name="city + '专业队力量编成表'" class="top-15" />
    <PsbzTable :headers="zydHeaders" :tableData="zydList" />
    <FirstTitle :name="city + '重要目标统计表'" class="top-15" />
    <PsbzTable :headers="zymbHeaders" :tableData="zymbList" />
  </div>
</template>
<style scoped lang="scss">
</style>